home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / pc / software / entwickl / macos / waste13a.hqx / WASTE 1.3a3 Distribution / WASTE Pascal Interfaces / WASTE.p < prev    next >
Text File  |  1997-01-06  |  29KB  |  939 lines

  1. UNIT WASTE;
  2.  
  3. { Pascal interface to the WASTE text engine }
  4.  
  5. { version 1.3a3 (January 1997) }
  6.  
  7. { Copyright © 1993-1997 Marco Piovanelli }
  8. { All Rights Reserved }
  9.  
  10. INTERFACE
  11.     USES
  12.         ConditionalMacros,
  13.         Types,
  14.         MixedMode,
  15.         QuickdrawText,
  16.         Quickdraw,
  17.         Script,
  18.         TextUtils,
  19.         TextEdit,
  20.         Drag,
  21.         LongCoords;
  22.  
  23. {$PUSH}
  24. {$ALIGN MAC68K}
  25. {$LibExport+}
  26.  
  27.     CONST
  28.  
  29. { result codes }
  30.  
  31.         weCantUndoErr = -10015;                    { undo buffer is clear (= errAECantUndo) }
  32.         weEmptySelectionErr = -10013;            { empty selection range (= errAENoUserSelection) }
  33.         weNotHandledErr = -1708;                { please use default behavior (= errAEEventNotHandled) }
  34.         weUnknownObjectTypeErr = -9478;            { specified object type is not registered }
  35.         weObjectNotFoundErr = -9477;            { no object found at specified offset }
  36.         weReadOnlyErr = -9476;                    { cannot modify instance }
  37.         weUndefinedSelectorErr = -50;            { unknown selector (= paramErr) }
  38.  
  39. { alignment styles }
  40.  
  41.         weFlushLeft = -2;                    { flush left }
  42.         weFlushRight = -1;                    { flush right }
  43.         weFlushDefault = 0;                    { flush according to system direction }
  44.         weCenter = 1;                        { centered }
  45.         weJustify = 2;                        { fully justified }
  46.  
  47. { primary line direction }
  48.  
  49.         weDirDefault = 1;                    { according to system direction }
  50.         weDirRightToLeft = -1;                { force right-to-left }
  51.         weDirLeftToRight = 0;                { force left-to-right }
  52.  
  53. { values for the mode parameter in WESetStyle and WEContinuousStyle }
  54.  
  55.         weDoFont                     = $0001;    { set font family number }
  56.         weDoFace                     = $0002;    { set Quickdraw styles }
  57.         weDoSize                     = $0004;    { set type size }
  58.         weDoColor                     = $0008;    { set color }
  59.         weDoAll                     = weDoFont + weDoFace + weDoSize + weDoColor;
  60.         weDoAddSize                 = $0010;    { adjust type size }
  61.         weDoToggleFace                 = $0020;    { turn a style off if it's continuous over the selection }
  62.         weDoReplaceFace             = $0040;    { replace existing styles outright }
  63.         weDoPreserveScript            = $0080;    { don't change scripts when applying a font change }
  64.         weDoExtractSubscript         = $0100;    { extract subscripts when applying a font change }
  65.         weDoFaceMask                 = $0200;    { set Quickdraw styles using mask field }
  66.  
  67. { values for the edge parameter in WEGetOffset etc. }
  68.  
  69.         kLeadingEdge = -1;            { point is on the leading edge of a glyph }
  70.         kTrailingEdge = 0;            { point is on the trailing edge of a glyph }
  71.         kObjectEdge = 2;            { point is in the middle of an embedded object }
  72.  
  73. { values for WEFeatureFlag feature parameter }
  74.  
  75.         weFAutoScroll                 = 0;            { automatically scroll the selection range into view }
  76.         weFOutlineHilite             = 2;            { frame selection when deactivated }
  77.         weFReadOnly                 = 5;            { disallow modifications }
  78.         weFUndo                     = 6;            { support WEUndo }
  79.         weFIntCutAndPaste             = 7;            { use intelligent cut-and-paste rules }
  80.         weFDragAndDrop                 = 8;            { support drag-and-drop text editing }
  81.         weFInhibitRecal             = 9;            { don't recalculate line starts and don't redraw text }
  82.         weFUseTempMem                 = 10;            { use temporary memory for main data structures }
  83.         weFDrawOffscreen             = 11;            { draw text offscreen for smoother visual results }
  84.         weFInhibitRedraw             = 12;            { don't redraw text }
  85.         weFMonoStyled                = 13;            { disallow style changes }
  86.         weFInhibitColor             = 31;            { draw in black & white only }
  87.  
  88. { values for WENew flags parameter }
  89.  
  90.         weDoAutoScroll                 = $00000001;
  91.         weDoOutlineHilite             = $00000004;
  92.         weDoReadOnly                 = $00000020;
  93.         weDoUndo                     = $00000040;
  94.         weDoIntCutAndPaste             = $00000080;
  95.         weDoDragAndDrop             = $00000100;
  96.         weDoInhibitRecal             = $00000200;
  97.         weDoUseTempMem                 = $00000400;
  98.         weDoDrawOffscreen             = $00000800;
  99.         weDoInhibitRedraw            = $00001000;
  100.         weDoMonoStyled                = $00002000;
  101.         weDoInhibitColor            = $80000000;
  102.  
  103. { values for WEFeatureFlag action parameter }
  104.  
  105.         weBitToggle = -2;        { toggles the specified feature }
  106.         weBitTest = -1;            { returns the current setting of the specified feature }
  107.         weBitClear = 0;            { disables the specified feature }
  108.         weBitSet = 1;            { enables the specified feature }
  109.  
  110. { values for WEGetInfo and WESetInfo selector parameter }
  111.  
  112.         weCharByteHook             = 'cbyt';    { CharByte hook }
  113.         weCharToPixelHook         = 'c2p ';    { CharToPixel hook }
  114.         weCharTypeHook             = 'ctyp';    { CharType hook }
  115.         weClickLoop             = 'clik';    { click loop callback }
  116.         weCurrentDrag             = 'drag';    { drag currently being tracked from WEClick }
  117.         weDrawTextHook             = 'draw';    { text drawing hook }
  118.         weEraseHook                = 'eras';    { background erasing hook }
  119.         weHiliteDropAreaHook     = 'hidr';    { drop area highlighting hook }
  120.         weLineBreakHook         = 'lbrk';    { line breaking hook }
  121.         wePixelToCharHook         = 'p2c ';    { PixelToChar hook }
  122.         wePort                     = 'port';    { graphics port }
  123.         weRefCon                 = 'refc';    { reference constant for use by application }
  124.         weScrollProc             = 'scrl';    { scroll callback }
  125.         weText                     = 'text';    { handle to the raw text }
  126.         weTranslateDragHook     = 'xdrg';    { drag translation callback }
  127.         weTranslucencyThreshold    = 'tluc';    { area threshold for translucent drags }
  128.         weTSMDocumentID         = 'tsmd';    { Text Services Manager document ID }
  129.         weTSMPreUpdate             = 'pre ';    { Text Services Manager pre-update callback }
  130.         weTSMPostUpdate         = 'post';    { Text Services Manager post-update callback }
  131.         weURLHint                 = 'urlh';    { URL hint string for Internet Config }
  132.         weWordBreakHook         = 'wbrk';    { word breaking hook }
  133.  
  134. { values for WEInstallObjectHandler handlerSelector parameter }
  135.  
  136.         weNewHandler             = 'new ';    { new handler }
  137.         weDisposeHandler         = 'free';    { dispose handler }
  138.         weDrawHandler             = 'draw';    { draw handler }
  139.         weClickHandler             = 'clik';    { click handler }
  140.         weStreamHandler         = 'strm';    { stream handler }
  141.  
  142. { action kinds }
  143.  
  144.         weAKNone             = 0;    { null action }
  145.         weAKUnspecified     = 1;    { action of unspecified nature }
  146.         weAKTyping             = 2;    { some text has been typed in }
  147.         weAKCut             = 3;    { the selection range has been cut }
  148.         weAKPaste             = 4;    { something has been pasted }
  149.         weAKClear             = 5;    { the selection range has been deleted }
  150.         weAKDrag             = 6;    { drag and drop operation }
  151.         weAKSetStyle         = 7;    { some style has been applied to a text range }
  152.  
  153. { destination kinds for stream handler }
  154.  
  155.         weToScrap        =    0;
  156.         weToDrag        =    1;
  157.         weToSoup        =    2;
  158.  
  159.     TYPE
  160.  
  161. { WASTE data types }
  162.  
  163.         WEReference = Ptr;
  164.         WEObjectReference = Ptr;
  165.         WESoupHandle = Handle;
  166.         WEFontTableHandle = Handle;
  167.         WEActionKind = INTEGER;
  168.         WEAlignment = SignedByte;
  169.         WEDirection = INTEGER;
  170.         WEStyleMode = INTEGER;
  171.         WESelector = FourCharCode;
  172.         WEHandle = WEReference;        { obsolete; kept for backward compatibility }
  173.  
  174.         WERunInfo = RECORD
  175.                 runStart: LONGINT;                { byte offset to first character of style run }
  176.                 runEnd: LONGINT;                { byte offset past last character of style run }
  177.                 runHeight: INTEGER;                { line height (ascent + descent + leading) }
  178.                 runAscent: INTEGER;                { font ascent }
  179.                 runStyle: TextStyle;            { text attributes }
  180.                 runObject: WEObjectReference;    { either NIL or reference to embedded object }
  181.             END;  { WERunInfo }
  182.  
  183. { callback prototypes }
  184.  
  185. { FUNCTION MyClickLoop (we: WEReference): BOOLEAN; }
  186.         WEClickLoopProcPtr = ProcPtr;
  187.         WEClickLoopUPP = UniversalProcPtr;
  188.  
  189. { PROCEDURE MyScrollProc (we: WEReference); }
  190.         WEScrollProcPtr = ProcPtr;
  191.         WEScrollUPP = UniversalProcPtr;
  192.  
  193. { PROCEDURE MyTSMPreUpdate (we: WEReference); }
  194.         WETSMPreUpdateProcPtr = ProcPtr;
  195.         WETSMPreUpdateUPP = UniversalProcPtr;
  196.  
  197. { PROCEDURE MyTSMPostUpdate (we: WEReference; fixLength: LONGINT; }
  198. {         inputAreaStart, inputAreaEnd: LONGINT; }
  199. {        pinRangeStart, pinRangeEnd: LONGINT); }
  200.         WETSMPostUpdateProcPtr = ProcPtr;
  201.         WETSMPostUpdateUPP = UniversalProcPtr;
  202.  
  203. { FUNCTION MyTranslateDrag (theDrag: DragReference; theItem: ItemReference; }
  204. {         requestedType: FlavorType; putDataHere: Handle; }
  205. {        dropOffset: LONGINT; we: WEReference): OSErr; }
  206.         WETranslateDragProcPtr = ProcPtr;
  207.         WETranslateDragUPP = UniversalProcPtr;
  208.  
  209. { FUNCTION MyHiliteDropArea (theDrag: DragReference; hiliteFlag: BOOLEAN; }
  210. {        we: WEReference): OSErr; }
  211.         WEHiliteDropAreaProcPtr = ProcPtr;
  212.         WEHiliteDropAreaUPP = UniversalProcPtr;
  213.  
  214. { FUNCTION MyFontIDToName (fontID: INTEGER; VAR fontName: Str255): OSErr; }
  215.         WEFontIDToNameProcPtr = ProcPtr;
  216.         WEFontIDToNameUPP = UniversalProcPtr;
  217.  
  218. { FUNCTION MyFontNameToID (fontName: Str255; oldFontID: INTEGER; }
  219. {        VAR newFontID: INTEGER): OSErr; }
  220.         WEFontNameToIDProcPtr = ProcPtr;
  221.         WEFontNameToIDUPP = UniversalProcPtr;
  222.  
  223. { PROCEDURE MyDrawText (pText: Ptr; textLength: LONGINT; slop: Fixed; }
  224. {         styleRunPosition: JustStyleCode; we: WEReference); }
  225.         WEDrawTextProcPtr = ProcPtr;
  226.         WEDrawTextUPP = UniversalProcPtr;
  227.  
  228. { FUNCTION MyPixelToChar (pText: Ptr; textLength: LONGINT; slop: Fixed; }
  229. {         VAR pixelWidth: Fixed; VAR edge: SignedByte; }
  230. {         styleRunPosition: JustStyleCode; hPos: Fixed; we: WEReference): LONGINT; }
  231.         WEPixelToCharProcPtr = ProcPtr;
  232.         WEPixelToCharUPP = UniversalProcPtr;
  233.  
  234. { FUNCTION MyCharToPixel (pText: Ptr; textLength: LONGINT; slop: Fixed; }
  235. {        offset: LONGINT; direction: INTEGER; }
  236. {        styleRunPosition: JustStyleCode; hPos: INTEGER; we:WEReference): INTEGER; }
  237.         WECharToPixelProcPtr = ProcPtr;
  238.         WECharToPixelUPP = UniversalProcPtr;
  239.  
  240. { FUNCTION MyLineBreak (pText: Ptr; textLength: LONGINT; }
  241. {        textStart, textEnd: LONGINT; VAR textWidth: Fixed; VAR textOffset: LONGINT; }
  242. {        we: WEReference): StyledLineBreakCode; }
  243.         WELineBreakProcPtr = ProcPtr;
  244.         WELineBreakUPP = UniversalProcPtr;
  245.  
  246. { PROCEDURE MyWordBreak (pText: Ptr; textLength, offset: INTEGER; edge: SignedByte; }
  247. {                    VAR breakOffsets: OffsetTable; script: ScriptCode; we: WEReference); }
  248.         WEWordBreakProcPtr = ProcPtr;
  249.         WEWordBreakUPP = UniversalProcPtr;
  250.  
  251. { FUNCTION MyCharByte (pText: Ptr; textOffset: INTEGER; }
  252. {                     script: ScriptCode; we: WEReference): INTEGER; }
  253.         WECharByteProcPtr = ProcPtr;
  254.         WECharByteUPP = UniversalProcPtr;
  255.  
  256. { FUNCTION MyCharType (pText: Ptr; textOffset: INTEGER; }
  257. {                     script: ScriptCode; we: WEReference): INTEGER; }
  258.         WECharTypeProcPtr = ProcPtr;
  259.         WECharTypeUPP = UniversalProcPtr;
  260.  
  261. { PROCEDURE MyErase (VAR area: Rect; we: WEReference); }
  262.         WEEraseProcPtr = ProcPtr;
  263.         WEEraseUPP = UniversalProcPtr;
  264.  
  265. { FUNCTION MyNewObject (VAR defaultObjectSize: Point; }
  266. {                    objectRef: WEObjectReference): OSErr; }
  267.         WENewObjectProcPtr = ProcPtr;
  268.         WENewObjectUPP = UniversalProcPtr;
  269.  
  270. { FUNCTION MyDisposeObject (objectRef: WEObjectReference): OSErr; }
  271.         WEDisposeObjectProcPtr = ProcPtr;
  272.         WEDisposeObjectUPP = UniversalProcPtr;
  273.  
  274. { FUNCTION MyDrawObject (VAR destRect: Rect; }
  275. {         objectRef: WEObjectReference): OSErr }
  276.         WEDrawObjectProcPtr = ProcPtr;
  277.         WEDrawObjectUPP = UniversalProcPtr;
  278.  
  279. { FUNCTION MyClickObject (hitPt: Point; modifiers: EventModifiers; clickTime: LONGINT; }
  280. {         objectRef: WEObjectReference): BOOLEAN; }
  281.         WEClickObjectProcPtr = ProcPtr;
  282.         WEClickObjectUPP = UniversalProcPtr;
  283.  
  284. { FUNCTION MyStreamObject (destKind: INTEGER; VAR theType: FlavorType; }
  285. {        putDataHere: Handle; objectRef: WEObjectReference): OSErr; }
  286.         WEStreamObjectProcPtr = ProcPtr;
  287.         WEStreamObjectUPP = UniversalProcPtr;
  288.  
  289.     CONST
  290.  
  291. { UPP proc info }
  292.  
  293.         uppWEClickLoopProcInfo             = $000000D0;
  294.         uppWEScrollProcInfo             = $000000C0;
  295.         uppWETSMPreUpdateProcInfo         = $000000C0;
  296.         uppWETSMPostUpdateProcInfo         = $0003FFC0;
  297.         uppWETranslateDragProcInfo         = $0003FFE0;
  298.         uppWEHiliteDropAreaProcInfo     = $00000DE0;
  299.         uppWEFontIDToNameProcInfo        = $000003A0;
  300.         uppWEFontNameToIDProcInfo        = $00000EE0;
  301.         uppWEDrawTextProcInfo             = $0000EFC0;
  302.         uppWEPixelToCharProcInfo         = $003EFFF0;
  303.         uppWECharToPixelProcInfo         = $003ABFE0;
  304.         uppWELineBreakProcInfo             = $000FFFD0;
  305.         uppWEWordBreakProcInfo             = $000EDAC0;
  306.         uppWECharByteProcInfo             = $00003AE0;
  307.         uppWECharTypeProcInfo             = $00003AE0;
  308.         uppWEEraseProcInfo                = $000003C0;
  309.         uppWENewObjectProcInfo             = $000003E0;
  310.         uppWEDisposeObjectProcInfo         = $000000E0;
  311.         uppWEDrawObjectProcInfo         = $000003E0;
  312.         uppWEClickObjectProcInfo         = $00003ED0;
  313.         uppWEStreamObjectProcInfo         = $00003FA0;
  314.  
  315. { NewProc macros }
  316.  
  317.     FUNCTION NewWEClickLoopProc (userRoutine: WEClickLoopProcPtr): WEClickLoopUPP;
  318. {$IFC NOT GENERATINGCFM}
  319.     INLINE
  320.         $2E9F;
  321. {$ENDC}
  322.  
  323.     FUNCTION NewWEScrollProc (userRoutine: WEScrollProcPtr): WEScrollUPP;
  324. {$IFC NOT GENERATINGCFM}
  325.     INLINE
  326.         $2E9F;
  327. {$ENDC}
  328.  
  329.     FUNCTION NewWETSMPreUpdateProc (userRoutine: WETSMPreUpdateProcPtr): WETSMPreUpdateUPP;
  330. {$IFC NOT GENERATINGCFM}
  331.     INLINE
  332.         $2E9F;
  333. {$ENDC}
  334.  
  335.     FUNCTION NewWETSMPostUpdateProc (userRoutine: WETSMPostUpdateProcPtr): WETSMPostUpdateUPP;
  336. {$IFC NOT GENERATINGCFM}
  337.     INLINE
  338.         $2E9F;
  339. {$ENDC}
  340.  
  341.     FUNCTION NewWETranslateDragProc (userRoutine: WETranslateDragProcPtr): WETranslateDragUPP;
  342. {$IFC NOT GENERATINGCFM}
  343.     INLINE
  344.         $2E9F;
  345. {$ENDC}
  346.  
  347.     FUNCTION NewWEHiliteDropAreaProc (userRoutine: WEHiliteDropAreaProcPtr): WEHiliteDropAreaUPP;
  348. {$IFC NOT GENERATINGCFM}
  349.     INLINE
  350.         $2E9F;
  351. {$ENDC}
  352.  
  353.     FUNCTION NewWEFontIDToNameProc (userRoutine: WEFontIDToNameProcPtr): WEFontIDToNameUPP;
  354. {$IFC NOT GENERATINGCFM}
  355.     INLINE
  356.         $2E9F;
  357. {$ENDC}
  358.  
  359.     FUNCTION NewWEFontNameToIDProc (userRoutine: WEFontNameToIDProcPtr): WEFontNameToIDUPP;
  360. {$IFC NOT GENERATINGCFM}
  361.     INLINE
  362.         $2E9F;
  363. {$ENDC}
  364.  
  365.     FUNCTION NewWEDrawTextProc (userRoutine: WEDrawTextProcPtr): WEDrawTextUPP;
  366. {$IFC NOT GENERATINGCFM}
  367.     INLINE
  368.         $2E9F;
  369. {$ENDC}
  370.  
  371.     FUNCTION NewWEPixelToCharProc (userRoutine: WEPixelToCharProcPtr): WEPixelToCharUPP;
  372. {$IFC NOT GENERATINGCFM}
  373.     INLINE
  374.         $2E9F;
  375. {$ENDC}
  376.  
  377.     FUNCTION NewWECharToPixelProc (userRoutine: WECharToPixelProcPtr): WECharToPixelUPP;
  378. {$IFC NOT GENERATINGCFM}
  379.     INLINE
  380.         $2E9F;
  381. {$ENDC}
  382.  
  383.     FUNCTION NewWELineBreakProc (userRoutine: WELineBreakProcPtr): WELineBreakUPP;
  384. {$IFC NOT GENERATINGCFM}
  385.     INLINE
  386.         $2E9F;
  387. {$ENDC}
  388.  
  389.     FUNCTION NewWEWordBreakProc (userRoutine: WEWordBreakProcPtr): WEWordBreakUPP;
  390. {$IFC NOT GENERATINGCFM}
  391.     INLINE
  392.         $2E9F;
  393. {$ENDC}
  394.  
  395.     FUNCTION NewWECharByteProc (userRoutine: WECharByteProcPtr): WECharByteUPP;
  396. {$IFC NOT GENERATINGCFM}
  397.     INLINE
  398.         $2E9F;
  399. {$ENDC}
  400.  
  401.     FUNCTION NewWECharTypeProc (userRoutine: WECharTypeProcPtr): WECharTypeUPP;
  402. {$IFC NOT GENERATINGCFM}
  403.     INLINE
  404.         $2E9F;
  405. {$ENDC}
  406.  
  407.     FUNCTION NewWEEraseProc (userRoutine: WEEraseProcPtr): WEEraseUPP;
  408. {$IFC NOT GENERATINGCFM}
  409.     INLINE
  410.         $2E9F;
  411. {$ENDC}
  412.  
  413.     FUNCTION NewWENewObjectProc (userRoutine: WENewObjectProcPtr): WENewObjectUPP;
  414. {$IFC NOT GENERATINGCFM}
  415.     INLINE
  416.         $2E9F;
  417. {$ENDC}
  418.  
  419.     FUNCTION NewWEDisposeObjectProc (userRoutine: WEDisposeObjectProcPtr): WEDisposeObjectUPP;
  420. {$IFC NOT GENERATINGCFM}
  421.     INLINE
  422.         $2E9F;
  423. {$ENDC}
  424.  
  425.     FUNCTION NewWEDrawObjectProc (userRoutine: WEDrawObjectProcPtr): WEDrawObjectUPP;
  426. {$IFC NOT GENERATINGCFM}
  427.     INLINE
  428.         $2E9F;
  429. {$ENDC}
  430.  
  431.     FUNCTION NewWEClickObjectProc (userRoutine: WEClickObjectProcPtr): WEClickObjectUPP;
  432. {$IFC NOT GENERATINGCFM}
  433.     INLINE
  434.         $2E9F;
  435. {$ENDC}
  436.  
  437.     FUNCTION NewWEStreamObjectProc (userRoutine: WEStreamObjectProcPtr): WEStreamObjectUPP;
  438. {$IFC NOT GENERATINGCFM}
  439.     INLINE
  440.         $2E9F;
  441. {$ENDC}
  442.  
  443. { CallProc macros }
  444.  
  445.     FUNCTION CallWEClickLoopProc (we: WEReference;
  446.                                     userRoutine: WEClickLoopUPP): BOOLEAN;
  447. {$IFC NOT GENERATINGCFM}
  448.     INLINE
  449.         $205F, $4E90;
  450. {$ENDC}
  451.  
  452.     PROCEDURE CallWEScrollProc (we: WEReference;
  453.                                     userRoutine: WEScrollUPP);
  454. {$IFC NOT GENERATINGCFM}
  455.     INLINE
  456.         $205F, $4E90;
  457. {$ENDC}
  458.  
  459.     PROCEDURE CallWETSMPreUpdateProc (we: WEReference;
  460.                                     userRoutine: WETSMPreUpdateUPP);
  461. {$IFC NOT GENERATINGCFM}
  462.     INLINE
  463.         $205F, $4E90;
  464. {$ENDC}
  465.  
  466.     PROCEDURE CallWETSMPostUpdateProc (we: WEReference;
  467.                                     fixLength: LONGINT;
  468.                                     inputAreaStart, inputAreaEnd: LONGINT;
  469.                                     pinRangeStart, pinRangeEnd: LONGINT;
  470.                                     userRoutine: WETSMPostUpdateUPP);
  471. {$IFC NOT GENERATINGCFM}
  472.     INLINE
  473.         $205F, $4E90;
  474. {$ENDC}
  475.  
  476.     FUNCTION CallWETranslateDragProc (theDrag: DragReference;
  477.                                     theItem: ItemReference;
  478.                                     requestedType: FlavorType;
  479.                                     putDataHere: Handle;
  480.                                     dropOffset: LONGINT;
  481.                                     we: WEReference;
  482.                                     userRoutine: WETranslateDragUPP): OSErr;
  483. {$IFC NOT GENERATINGCFM}
  484.     INLINE
  485.         $205F, $4E90;
  486. {$ENDC}
  487.  
  488.     FUNCTION CallWEHiliteDropAreaProc (theDrag: DragReference;
  489.                                     hiliteFlag: BOOLEAN;
  490.                                     we: WEReference;
  491.                                     userRoutine: WEHiliteDropAreaUPP): OSErr;
  492. {$IFC NOT GENERATINGCFM}
  493.     INLINE
  494.         $205F, $4E90;
  495. {$ENDC}
  496.  
  497.     FUNCTION CallWEFontIDToNameProc (fontID: INTEGER;
  498.                                     VAR fontName: Str255;
  499.                                     userRoutine: WEFontIDToNameUPP): OSErr;
  500. {$IFC NOT GENERATINGCFM}
  501.     INLINE
  502.         $205F, $4E90;
  503. {$ENDC}
  504.  
  505.     FUNCTION CallWEFontNameToIDProc ({CONST} VAR fontName: Str255;
  506.                                     oldFontID: INTEGER;
  507.                                     VAR newFontID: INTEGER;
  508.                                     userRoutine: WEFontNameToIDUPP): OSErr;
  509. {$IFC NOT GENERATINGCFM}
  510.     INLINE
  511.         $205F, $4E90;
  512. {$ENDC}
  513.  
  514.     PROCEDURE CallWEDrawTextProc (pText: Ptr;
  515.                                     textLength: LONGINT;
  516.                                     slop: Fixed;
  517.                                     styleRunPosition: JustStyleCode;
  518.                                     we: WEReference;
  519.                                     userRoutine: WEDrawTextUPP);
  520. {$IFC NOT GENERATINGCFM}
  521.     INLINE
  522.         $205F, $4E90;
  523. {$ENDC}
  524.  
  525.     FUNCTION CallWEPixelToCharProc (pText: Ptr;
  526.                                     textLength: LONGINT;
  527.                                     slop: Fixed;
  528.                                     VAR width: Fixed;
  529.                                     VAR edge: SignedByte;
  530.                                     styleRunPosition: JustStyleCode;
  531.                                     hPos: Fixed;
  532.                                     we: WEReference;
  533.                                     userRoutine: WEPixelToCharUPP): LONGINT;
  534. {$IFC NOT GENERATINGCFM}
  535.     INLINE
  536.         $205F, $4E90;
  537. {$ENDC}
  538.  
  539.     FUNCTION CallWECharToPixelProc (pText: Ptr;
  540.                                     textLength: LONGINT;
  541.                                     slop: Fixed;
  542.                                     offset: LONGINT;
  543.                                     direction: INTEGER;
  544.                                     styleRunPosition: JustStyleCode;
  545.                                     hPos: INTEGER;
  546.                                     we: WEReference;
  547.                                     userRoutine: WECharToPixelUPP): INTEGER;
  548. {$IFC NOT GENERATINGCFM}
  549.     INLINE
  550.         $205F, $4E90;
  551. {$ENDC}
  552.  
  553.     FUNCTION CallWELineBreakProc (pText: Ptr;
  554.                                     textLength: LONGINT;
  555.                                     textStart, textEnd: LONGINT;
  556.                                     VAR textWidth: Fixed;
  557.                                     VAR textOffset: LONGINT;
  558.                                     we: WEReference;
  559.                                     userRoutine: WELineBreakUPP): StyledLineBreakCode;
  560. {$IFC NOT GENERATINGCFM}
  561.     INLINE
  562.         $205F, $4E90;
  563. {$ENDC}
  564.  
  565.     PROCEDURE CallWEWordBreakProc (pText: Ptr;
  566.                                     textLength, offset: INTEGER;
  567.                                     edge: SignedByte;
  568.                                     VAR breakOffsets: OffsetTable;
  569.                                     script: ScriptCode;
  570.                                     we: WEReference;
  571.                                     userRoutine: WEWordBreakUPP);
  572. {$IFC NOT GENERATINGCFM}
  573.     INLINE
  574.         $205F, $4E90;
  575. {$ENDC}
  576.  
  577.     FUNCTION CallWECharByteProc (pText: Ptr;
  578.                                     textOffset: INTEGER;
  579.                                     script: ScriptCode;
  580.                                     we: WEReference;
  581.                                     userRoutine: WECharByteUPP): INTEGER;
  582. {$IFC NOT GENERATINGCFM}
  583.     INLINE
  584.         $205F, $4E90;
  585. {$ENDC}
  586.  
  587.     FUNCTION CallWECharTypeProc (pText: Ptr;
  588.                                     textOffset: INTEGER;
  589.                                     script: ScriptCode;
  590.                                     we: WEReference;
  591.                                     userRoutine: WECharTypeUPP): INTEGER;
  592. {$IFC NOT GENERATINGCFM}
  593.     INLINE
  594.         $205F, $4E90;
  595. {$ENDC}
  596.  
  597.     PROCEDURE CallWEEraseProc ({CONST} VAR area: Rect;
  598.                                     we: WEReference;
  599.                                     userRoutine: WEEraseUPP);
  600. {$IFC NOT GENERATINGCFM}
  601.     INLINE
  602.         $205F, $4E90;
  603. {$ENDC}
  604.  
  605.     FUNCTION CallWENewObjectProc (VAR defaultObjectSize: Point;
  606.                                     objectRef: WEObjectReference;
  607.                                     userRoutine: WENewObjectUPP): OSErr;
  608. {$IFC NOT GENERATINGCFM}
  609.     INLINE
  610.         $205F, $4E90;
  611. {$ENDC}
  612.  
  613.     FUNCTION CallWEDisposeObjectProc (objectRef: WEObjectReference;
  614.                                     userRoutine: WEDisposeObjectUPP): OSErr;
  615. {$IFC NOT GENERATINGCFM}
  616.     INLINE
  617.         $205F, $4E90;
  618. {$ENDC}
  619.  
  620.     FUNCTION CallWEDrawObjectProc ({CONST} VAR destRect: Rect;
  621.                                     objectRef: WEObjectReference;
  622.                                     userRoutine: WEDrawObjectUPP): OSErr;
  623. {$IFC NOT GENERATINGCFM}
  624.     INLINE
  625.         $205F, $4E90;
  626. {$ENDC}
  627.  
  628.     FUNCTION CallWEClickObjectProc (hitPoint: Point;
  629.                                     modifiers: EventModifiers;
  630.                                     clickTime: LONGINT;
  631.                                     objectRef: WEObjectReference;
  632.                                     userRoutine: WEClickObjectUPP): BOOLEAN;
  633. {$IFC NOT GENERATINGCFM}
  634.     INLINE
  635.         $205F, $4E90;
  636. {$ENDC}
  637.  
  638.     FUNCTION CallWEStreamObjectProc (destKind: INTEGER;
  639.                                     VAR theType: FlavorType;
  640.                                     putDataHere: Handle;
  641.                                     objectRef: WEObjectReference;
  642.                                     userRoutine: WEStreamObjectUPP): OSErr;
  643. {$IFC NOT GENERATINGCFM}
  644.     INLINE
  645.         $205F, $4E90;
  646. {$ENDC}
  647.  
  648.  
  649. { WASTE PUBLIC CALLS }
  650.  
  651. { getting the shared library version number }
  652.  
  653.     FUNCTION WEVersion: NumVersion;
  654.  
  655. { creation and destruction }
  656.  
  657.     FUNCTION WENew ({CONST} VAR destRect, viewRect: LongRect;
  658.                                     flags: LONGINT;
  659.                                     VAR we: WEReference): OSErr;
  660.     PROCEDURE WEDispose (we: WEReference);
  661.  
  662. { getting variables }
  663.  
  664.     FUNCTION WEGetText (we: WEReference): Handle;
  665.     FUNCTION WEGetChar (offset: LONGINT;
  666.                                     we: WEReference): CHAR;
  667.     FUNCTION WEGetTextLength (we: WEReference): LONGINT;
  668.     FUNCTION WEGetHeight (startLine, endLine: LONGINT;
  669.                                     we: WEReference): LONGINT;
  670.     PROCEDURE WEGetSelection (VAR selStart, selEnd: LONGINT;
  671.                                     we: WEReference);
  672.     PROCEDURE WEGetDestRect (VAR destRect: LongRect;
  673.                                     we: WEReference);
  674.     PROCEDURE WEGetViewRect (VAR viewRect: LongRect;
  675.                                     we: WEReference);
  676.     FUNCTION WEIsActive (we: WEReference): BOOLEAN;
  677.     FUNCTION WEOffsetToLine (offset: LONGINT;
  678.                                     we: WEReference): LONGINT;
  679.     PROCEDURE WEGetLineRange (lineNo: LONGINT;
  680.                                     VAR lineStart, lineEnd: LONGINT;
  681.                                     we: WEReference);
  682.     FUNCTION WECountLines (we: WEReference): LONGINT;
  683.     FUNCTION WEOffsetToRun (offset: LONGINT;
  684.                                     we: WEReference): LONGINT;
  685.     PROCEDURE WEGetRunRange (runIndex: LONGINT;
  686.                                     VAR runStart, runEnd: LONGINT;
  687.                                     we: WEReference);
  688.     FUNCTION WECountRuns (we: WEReference): LONGINT;
  689.     FUNCTION WEGetClickCount (we: WEReference): INTEGER;
  690.  
  691. { setting variables }
  692.  
  693.     PROCEDURE WESetSelection (selStart, selEnd: LONGINT;
  694.                                     we: WEReference);
  695.     PROCEDURE WESetDestRect ({CONST} VAR destRect: LongRect;
  696.                                     we: WEReference);
  697.     PROCEDURE WESetViewRect ({CONST} VAR viewRect: LongRect;
  698.                                     we: WEReference);
  699.  
  700. { accessing style run information }
  701.  
  702.     FUNCTION WEContinuousStyle (VAR mode: WEStyleMode;
  703.                                     VAR ts: TextStyle;
  704.                                     we: WEReference): BOOLEAN;
  705.     PROCEDURE WEGetRunInfo (offset: LONGINT;
  706.                                     VAR info: WERunInfo;
  707.                                     we: WEReference);
  708.  
  709. { converting byte offsets to screen positions and vice versa }
  710.  
  711.     FUNCTION WEGetOffset ({CONST} VAR thePoint: LongPt;
  712.                                     VAR edge: SignedByte;
  713.                                     we: WEReference): LONGINT;
  714.     PROCEDURE WEGetPoint (offset: LONGINT;
  715.                                     direction: INTEGER;
  716.                                     VAR thePoint: LongPt;
  717.                                     VAR lineHeight: INTEGER;
  718.                                     we: WEReference);
  719.  
  720. { finding words and lines }
  721.  
  722.     PROCEDURE WEFindWord (offset: LONGINT;
  723.                                     edge: SignedByte;
  724.                                     VAR wordStart, wordEnd: LONGINT;
  725.                                     we: WEReference);
  726.     PROCEDURE WEFindLine (offset: LONGINT;
  727.                                     edge: SignedByte;
  728.                                     VAR lineStart, lineEnd: LONGINT;
  729.                                     we: WEReference);
  730.  
  731. { making a copy of a text range }
  732.  
  733.     FUNCTION WECopyRange (rangeStart, rangeEnd: LONGINT;
  734.                                     hText: Handle;
  735.                                     hStyles: StScrpHandle;
  736.                                     hSoup: WESoupHandle;
  737.                                     we: WEReference): OSErr;
  738.  
  739. { getting and setting the alignment style }
  740.  
  741.     FUNCTION WEGetAlignment (we: WEReference): WEAlignment;
  742.     PROCEDURE WESetAlignment (alignment: WEAlignment;
  743.                                     we: WEReference);
  744.  
  745. { getting and setting the primary line direction }
  746.  
  747.     FUNCTION WEGetDirection (we: WEReference): WEDirection;
  748.     PROCEDURE WESetDirection (direction: WEDirection;
  749.                                     we: WEReference);
  750.  
  751. { recalculating line breaks, drawing and scrolling }
  752.  
  753.     FUNCTION WECalText (we: WEReference): OSErr;
  754.     PROCEDURE WEUpdate (updateRgn: RgnHandle;
  755.                                     we: WEReference);
  756.     PROCEDURE WEScroll (hOffset, vOffset: LONGINT;
  757.                                     we: WEReference);
  758.     PROCEDURE WESelView (we: WEReference);
  759.  
  760. { handling activate/deactivate events }
  761.  
  762.     PROCEDURE WEActivate (we: WEReference);
  763.     PROCEDURE WEDeactivate (we: WEReference);
  764.  
  765. { handling key-down events }
  766.  
  767.     PROCEDURE WEKey (key: CHAR;
  768.                                     modifiers: EventModifiers;
  769.                                     we: WEReference);
  770.  
  771. { handling mouse-down events and mouse tracking }
  772.  
  773.     PROCEDURE WEClick (hitPt: Point;
  774.                                     modifiers: EventModifiers;
  775.                                     clickTime: LONGINT;
  776.                                     we: WEReference);
  777.  
  778. { adjusting the cursor shape }
  779.  
  780.     FUNCTION WEAdjustCursor (mouseLoc: Point;
  781.                                     mouseRgn: RgnHandle;
  782.                                     we: WEReference): BOOLEAN;
  783.  
  784. { blinking the caret }
  785.  
  786.     PROCEDURE WEIdle (VAR maxSleep: LONGINT;
  787.                                     we: WEReference);
  788.  
  789. { modifying the text and the styles }
  790.  
  791.     FUNCTION WEInsert (pText: Ptr;
  792.                                     textLength: LONGINT;
  793.                                     hStyles: StScrpHandle;
  794.                                     hSoup: WESoupHandle;
  795.                                     we: WEReference): OSErr;
  796.     FUNCTION WEDelete (we: WEReference): OSErr;
  797.     FUNCTION WESetStyle (mode: WEStyleMode;
  798.                                     {CONST} VAR ts: TextStyle;
  799.                                     we: WEReference): OSErr;
  800.     FUNCTION WEUseText (hText: Handle;
  801.                                     we: WEReference): OSErr;
  802.     FUNCTION WEUseStyleScrap (hStyles: StScrpHandle;
  803.                                     we: WEReference): OSErr;
  804.  
  805. { undo }
  806.  
  807.     FUNCTION WEUndo (we: WEReference): OSErr;
  808.     PROCEDURE WEClearUndo (we: WEReference);
  809.     FUNCTION WEGetUndoInfo (VAR redoFlag: BOOLEAN;
  810.                                     we: WEReference): WEActionKind;
  811.     FUNCTION WEIsTyping (we: WEReference): BOOLEAN;
  812.     FUNCTION WEBeginAction (we: WEReference): OSErr;
  813.     FUNCTION WEEndAction (actionKind: WEActionKind;
  814.                                     we: WEReference): OSErr;
  815.  
  816. { keeping track of changes }
  817.  
  818.     FUNCTION WEGetModCount (we: WEReference): LONGINT;
  819.     PROCEDURE WEResetModCount (we: WEReference);
  820.  
  821. { embedded objects }
  822.  
  823.     FUNCTION WEInstallObjectHandler (objectType: FlavorType;
  824.                                     handlerSelector: WESelector;
  825.                                     handler: ProcPtr;
  826.                                     we: WEReference): OSErr;
  827.     FUNCTION WEGetObjectHandler (objectType: FlavorType;
  828.                                     handlerSelector: WESelector;
  829.                                     VAR handler: ProcPtr;
  830.                                     we: WEReference): OSErr;
  831.     FUNCTION WEInsertObject (objectType: FlavorType;
  832.                                     objectDataHandle: Handle;
  833.                                     objectSize: Point;        { (0, 0) means default size }
  834.                                     we: WEReference): OSErr;
  835.     FUNCTION WEGetSelectedObject (VAR objectRef: WEObjectReference;
  836.                                     we: WEReference): OSErr;
  837.     FUNCTION WEFindNextObject (offset: LONGINT;
  838.                                     VAR objectRef: WEObjectReference;
  839.                                     we: WEReference): LONGINT;
  840.     FUNCTION WEUseSoup (hSoup: WESoupHandle;
  841.                                     we: WEReference): OSErr;
  842.  
  843. { accessing embedded object attributes }
  844.  
  845.     FUNCTION WEGetObjectType (objectRef: WEObjectReference): FlavorType;
  846.     FUNCTION WEGetObjectDataHandle (objectRef: WEObjectReference): Handle;
  847.     FUNCTION WEGetObjectSize (objectRef: WEObjectReference): Point;
  848.     FUNCTION WEGetObjectOwner (objectRef: WEObjectReference): WEReference;
  849.     FUNCTION WEGetObjectRefCon (objectRef: WEObjectReference): LONGINT;
  850.     PROCEDURE WESetObjectRefCon (objectRef: WEObjectReference;
  851.                                     refCon: LONGINT);
  852.  
  853. { Clipboard operations }
  854.  
  855.     FUNCTION WECut (we: WEReference): OSErr;
  856.     FUNCTION WECopy (we: WEReference): OSErr;
  857.     FUNCTION WEPaste (we: WEReference): OSErr;
  858.     FUNCTION WECanPaste (we: WEReference): BOOLEAN;
  859.  
  860. { Drag Manager support }
  861.  
  862.     FUNCTION WEGetHiliteRgn (rangeStart, rangeEnd: LONGINT;
  863.                                     we: WEReference): RgnHandle;
  864.     FUNCTION WETrackDrag (message: DragTrackingMessage;
  865.                                     drag: DragReference;
  866.                                     we: WEReference): OSErr;
  867.     FUNCTION WEReceiveDrag (drag: DragReference;
  868.                                     we: WEReference): OSErr;
  869.     FUNCTION WECanAcceptDrag (drag: DragReference;
  870.                                     we: WEReference): BOOLEAN;
  871.     FUNCTION WEDraggedToTrash (drag: DragReference): BOOLEAN;
  872.  
  873. { font tables }
  874.  
  875.     FUNCTION WEBuildFontTable (hFontTable: WEFontTableHandle;
  876.                                     fontIDToNameProc: WEFontIDToNameUPP;
  877.                                     we: WEReference): OSErr;
  878.     FUNCTION WEUpdateFontTable (hFontTable: WEFontTableHandle;
  879.                                     fontNameToIDProc: WEFontNameToIDUPP;
  880.                                     VAR wasChanged: BOOLEAN): OSErr;
  881.     FUNCTION WEUpdateStyleScrap (hStyles: StScrpHandle;
  882.                                     hFontTable: WEFontTableHandle): OSErr;
  883.  
  884. { Script Manager utilities }
  885.  
  886.     FUNCTION WECharByte (offset: LONGINT;
  887.                                     we: WEReference): INTEGER;
  888.     FUNCTION WECharType (offset: LONGINT;
  889.                                     we: WEReference): INTEGER;
  890.  
  891. { Text Services Manager support }
  892.  
  893.     FUNCTION WEInstallTSMHandlers: OSErr;
  894.     FUNCTION WERemoveTSMHandlers: OSErr;
  895.     PROCEDURE WEStopInlineSession (we: WEReference);
  896.  
  897. { additional features }
  898.  
  899.     FUNCTION WEFeatureFlag (feature: INTEGER;
  900.                                     action: INTEGER;
  901.                                     we: WEReference): INTEGER;
  902.     FUNCTION WEGetInfo (selector: WESelector;
  903.                                     info: univ Ptr;
  904.                                     we: WEReference): OSErr;
  905.     FUNCTION WESetInfo (selector: WESelector;
  906.                                     info: univ Ptr;
  907.                                     we: WEReference): OSErr;
  908.  
  909. { getting and setting user-defined info }
  910.  
  911.     FUNCTION WEGetUserInfo (tag: WESelector;
  912.                                     VAR userInfo: LONGINT;
  913.                                     we: WEReference): OSErr;
  914.     FUNCTION WESetUserInfo (tag: WESelector;
  915.                                     userInfo: LONGINT;
  916.                                     we: WEReference): OSErr;
  917.  
  918. { long coordinates utility routines }
  919.  
  920.     PROCEDURE WELongPointToPoint ({CONST} VAR lp: LongPt;
  921.                                     VAR p: Point);
  922.     PROCEDURE WEPointToLongPoint (p: Point;
  923.                                     VAR lp: LongPt);
  924.     PROCEDURE WESetLongRect (VAR lr: LongRect;
  925.                                     left, top, right, bottom: LONGINT);
  926.     PROCEDURE WELongRectToRect ({CONST} VAR lr: LongRect;
  927.                                     VAR r: Rect);
  928.     PROCEDURE WERectToLongRect ({CONST} VAR r: Rect;
  929.                                     VAR lr: LongRect);
  930.     PROCEDURE WEOffsetLongRect (VAR lr: LongRect;
  931.                                     hOffset, vOffset: LONGINT);
  932.     FUNCTION WELongPointInLongRect ({CONST} VAR lp: LongPt;
  933.                                     {CONST} VAR lr: LongRect): BOOLEAN;
  934.  
  935. {$ALIGN RESET}
  936. {$POP}
  937.  
  938. IMPLEMENTATION
  939. END.